﻿<script type="text/javascript">
    $(function() {
        $("#ruku_chaxun_riqi_chart").click(function() {
            //查询
            BindData();
        });

        $("#ruku_zhandian_riqi_chart").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 175,
            panelHeight: 'auto',
            editable: false
        });

        $("#ruku_wuliaomingcheng_riqi_chart").combobox({
            url: 'handler/wuliao.ashx',
            method: 'get',
            queryParams: { wuliaoleixing: "入库物料", uid: window.uid, kid: window.kid },
            valueField: 'id',
            textField: 'wuliao',
            panelWidth: 175,
            panelHeight: 'auto',
            editable: false,
            onSelect: function(record) {
                $("#ruku_xinghao_riqi_chart").combobox({
                    url: 'handler/xinghao.ashx',
                    method: 'get',
                    queryParams: { wuliaoid: record.id, uid: window.uid, kid: window.kid },
                    valueField: 'xinghao',
                    textField: 'xinghao',
                    panelWidth: 175,
                    panelHeight: 'auto',
                    editable: false
                });
            },
            onLoadSuccess: function() {
                BindData();
            }
        });

        $("#ruku_xinghao_riqi_chart").combobox({
            data: [{ xinghao: '—全部—', selected: true}],
            valueField: 'xinghao',
            textField: 'xinghao',
            panelWidth: 175,
            panelHeight: 'auto',
            editable: false
        });

        var ruKuRiQiChart = echarts.init(document.getElementById("ruku_riqi_chart"));

        function BindData() {
            var dateKaiShi = $("#ruku_date_kaishi_riqi_chart").datetimebox('getValue');
            var dateJieShu = $("#ruku_date_jieshu_riqi_chart").datetimebox('getValue');
            var zhanDianStr = $("#ruku_zhandian_riqi_chart").combobox('getValue');
            var wuLiaoStr = $("#ruku_wuliaomingcheng_riqi_chart").combobox('getText');
            var xingHaoStr = $("#ruku_xinghao_riqi_chart").combobox('getText');

            $.get('handler/riqihuizong_chart.ashx', { chengzhongleixing: '入库物料', zhandian: zhanDianStr, kaishishijian: dateKaiShi, jieshushijian: dateJieShu, wuliaomingcheng: wuLiaoStr, xinghao: xingHaoStr, uid: window.uid, kid: window.kid }, function (data, status) {
                ruKuRiQiChart.clear();
                ruKuRiQiChart.setOption({
                    title: {
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data: data.legend,
                    itemGap: 3,
                    itemHeight: 10,
                    itemWidth: 15,
                    orient: 'vertical',
                    right:0,
                    height:'100%'
                },
                grid: {
                    top: '3%',
                    left: '3%',
                    right: 180,
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: data.x,
                    axisLabel: { rotate: 18, interval: 0 }
                },
                yAxis: {
                    type: 'value'
                },
                series: data.data
            });
        }, 'json');
    }

});

$.parser.onComplete = function() {
    var d = new Date();
    $("#ruku_date_kaishi_riqi_chart").datebox('setValue', d.toLocaleDateString());
    $("#ruku_date_jieshu_riqi_chart").datebox('setValue', d.toLocaleDateString());
} 
</script>

<div class="easyui-panel" data-options="height:110,border:false" title="数据检索" style="border-top-width: 0px;
    border-bottom-width: 1px; padding: 15px; width:100%">
    <table style="font-size: 12px;">
        <tr>
            <td>
                站点：
            </td>
            <td>
                <input class="" name="ruku_zhandian_riqi_chart" id="ruku_zhandian_riqi_chart" style="width: 175px;" />
            </td>
            <td>
                称重时间：
            </td>
            <td>
                <input id="ruku_date_kaishi_riqi_chart" type="text" class="easyui-datebox" data-options="required:true"
                    style="width: 175px">
                至
                <input id="ruku_date_jieshu_riqi_chart" type="text" class="easyui-datebox" data-options="required:true"
                    style="width: 175px">
            </td>

        </tr>
        <tr>
            <td>
                物料名称：
            </td>
            <td>
                <input id="ruku_wuliaomingcheng_riqi_chart" name="ruku_wuliaomingcheng_riqi_chart" data-options=""
                    style="width: 175px">
            </td>
            <td>
                型号：
            </td>
            <td>
                <input id="ruku_xinghao_riqi_chart" name="ruku_xinghao_riqi_chart" data-options="" style="width: 175px">
            </td>
            <td>
                <a id="ruku_chaxun_riqi_chart" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                    style="width: 60px; margin-left: 20px;">查询</a>
            </td>
        </tr>
    </table>
</div>
<div style="margin: 20px; width:100%">
    <div id="ruku_riqi_chart" style="width: 100%; height: 75%">
    </div>
</div>
